package my12306.bean;

import java.util.HashMap;
import my12306.http.TrainInfo;

/**
 * 返回执行结果。
 *
 * @author Jack
 */
public class QueryResult {

    public final static byte SUCC = 100;
    public final static byte FAIL = 101;
    public final static byte OTHER = 103;
    public final static byte RAND_CODE_ERROR = 104;
    public final static byte UNCERTAINTY = 105; // 不确定
    public final static byte NO_BOOKED_TICKET = 11;
    public final static byte HAVE_NO_PAY_TICKET = 12;
    public final static byte CANCEL_TIMES_TOO_MUCH = 13;
    public final static byte REPEAT_BUY_TICKET = 14;
    public final static byte ERROR_CARD_NUMBER = 15;
    public final static byte ACC_ERROR = 111;//用户名不存在
    public final static byte PWD_ERROR = 112;//密码错误
    public final static byte LOGIN_ERROR = 113;//网页返回内容包含<title>登录</title>
    public final static byte LOST_OF_PEOPLE = 114;//当前访问用户过多
    public final static byte USER_LOCKED = 115;//用户经被锁定
    private byte state = FAIL; // 请求处理状态 
    private String msg = "未知错误"; // 有效提示信息
    private String rawData;
    private Tokens tokens;
    private HashMap<String, TrainInfo> trains;
    private Object result;

    public byte getState() {
        return state;
    }

    public void setState(byte state) {
        this.state = state;
    }

    /**
     * @return Returns the msg.
     */
    public String getMsg() {
        return msg;
    }

    /**
     * @param msg The msg to set.
     */
    public void setMsg(String msg) {
        this.msg = msg;
    }

    /**
     * override 方法
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("Result [state=").append(state).append(", msg=")
                .append(msg).append("]");
        return builder.toString();
    }

    /**
     * @return the rawData
     */
    public String getRawData() {
        return rawData;
    }

    /**
     * @param rawData the rawData to set
     */
    public void setRawData(String rawData) {
        this.rawData = rawData;
    }

    /**
     * @return the tokens
     */
    public Tokens getTokens() {
        return tokens;
    }

    /**
     * @param tokens the tokens to set
     */
    public void setTokens(Tokens tokens) {
        this.tokens = tokens;
    }

    /**
     * @return the trains
     */
    public HashMap<String, TrainInfo> getTrains() {
        return trains;
    }

    /**
     * @param trains the trains to set
     */
    public void setTrains(HashMap<String, TrainInfo> trains) {
        this.trains = trains;
    }

    /**
     * @return the result
     */
    public Object getResult() {
        return result;
    }

    /**
     * @param result the result to set
     */
    public void setResult(Object result) {
        this.result = result;
    }
}
